<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div></div>
    <script>
      function showTime() {
        var date = new Date()
        var d = date.getDate().toString().padStart(2, '0')
        var m = (date.getMonth() + 1).toString().padStart(2, '0')
        var y = date.getFullYear().toString()
        var h = date.getHours().toString().padStart(2, '0')
        var f = date.getMinutes().toString().padStart(2, '0')
        var s = date.getSeconds().toString().padStart(2, '0')
        var time = `${y}-${m}-${d} ${h}:${f}:${s}`
        var div = document.querySelector('div')
        div.innerHTML = time
      }
      showTime()
      setInterval(showTime, 1000)
    </script>
  </body>
</html>
